Skip to content

Conversation

@koachan
Copy link
Contributor

@koachan koachan commented Nov 18, 2025

This follows the list of names used by GCC.

@llvmbot llvmbot added clang Clang issues not falling into any other category backend:Sparc clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 18, 2025
@koachan
Copy link
Contributor Author

koachan commented Nov 18, 2025

Context is at ziglang/zig#4931 (comment).
Tagging as WIP for now since I'm not really sure where to put the tests for this.

@llvmbot
Copy link
Member

llvmbot commented Nov 18, 2025

@llvm/pr-subscribers-backend-sparc

@llvm/pr-subscribers-clang

Author: Koakuma (koachan)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/168498.diff

1 Files Affected:

  • (modified) clang/lib/Basic/Targets/Sparc.cpp (+16-8)
diff --git a/clang/lib/Basic/Targets/Sparc.cpp b/clang/lib/Basic/Targets/Sparc.cpp
index d1a891092b0f5..7173ac8c22ceb 100644
--- a/clang/lib/Basic/Targets/Sparc.cpp
+++ b/clang/lib/Basic/Targets/Sparc.cpp
@@ -19,6 +19,7 @@ using namespace clang;
 using namespace clang::targets;
 
 const char *const SparcTargetInfo::GCCRegNames[] = {
+    // clang-format off
     // Integer registers
     "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",  "r8",  "r9",  "r10",
     "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21",
@@ -30,6 +31,10 @@ const char *const SparcTargetInfo::GCCRegNames[] = {
     "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "f32",
     "f34", "f36", "f38", "f40", "f42", "f44", "f46", "f48", "f50", "f52", "f54",
     "f56", "f58", "f60", "f62",
+
+    // Condition code registers
+    "icc", "fcc", "fcc1", "fcc2", "fcc3"
+    // clang-format on
 };
 
 ArrayRef<const char *> SparcTargetInfo::getGCCRegNames() const {
@@ -37,14 +42,17 @@ ArrayRef<const char *> SparcTargetInfo::getGCCRegNames() const {
 }
 
 const TargetInfo::GCCRegAlias SparcTargetInfo::GCCRegAliases[] = {
-    {{"g0"}, "r0"},  {{"g1"}, "r1"},  {{"g2"}, "r2"},        {{"g3"}, "r3"},
-    {{"g4"}, "r4"},  {{"g5"}, "r5"},  {{"g6"}, "r6"},        {{"g7"}, "r7"},
-    {{"o0"}, "r8"},  {{"o1"}, "r9"},  {{"o2"}, "r10"},       {{"o3"}, "r11"},
-    {{"o4"}, "r12"}, {{"o5"}, "r13"}, {{"o6", "sp"}, "r14"}, {{"o7"}, "r15"},
-    {{"l0"}, "r16"}, {{"l1"}, "r17"}, {{"l2"}, "r18"},       {{"l3"}, "r19"},
-    {{"l4"}, "r20"}, {{"l5"}, "r21"}, {{"l6"}, "r22"},       {{"l7"}, "r23"},
-    {{"i0"}, "r24"}, {{"i1"}, "r25"}, {{"i2"}, "r26"},       {{"i3"}, "r27"},
-    {{"i4"}, "r28"}, {{"i5"}, "r29"}, {{"i6", "fp"}, "r30"}, {{"i7"}, "r31"},
+    // clang-format off
+    {{"g0"}, "r0"},   {{"g1"}, "r1"},    {{"g2"}, "r2"},        {{"g3"}, "r3"},
+    {{"g4"}, "r4"},   {{"g5"}, "r5"},    {{"g6"}, "r6"},        {{"g7"}, "r7"},
+    {{"o0"}, "r8"},   {{"o1"}, "r9"},    {{"o2"}, "r10"},       {{"o3"}, "r11"},
+    {{"o4"}, "r12"},  {{"o5"}, "r13"},   {{"o6", "sp"}, "r14"}, {{"o7"}, "r15"},
+    {{"l0"}, "r16"},  {{"l1"}, "r17"},   {{"l2"}, "r18"},       {{"l3"}, "r19"},
+    {{"l4"}, "r20"},  {{"l5"}, "r21"},   {{"l6"}, "r22"},       {{"l7"}, "r23"},
+    {{"i0"}, "r24"},  {{"i1"}, "r25"},   {{"i2"}, "r26"},       {{"i3"}, "r27"},
+    {{"i4"}, "r28"},  {{"i5"}, "r29"},   {{"i6", "fp"}, "r30"}, {{"i7"}, "r31"},
+    {{"xcc"}, "icc"}, {{"fcc0"}, "fcc"}
+    // clang-format on
 };
 
 ArrayRef<TargetInfo::GCCRegAlias> SparcTargetInfo::getGCCRegAliases() const {

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

🐧 Linux x64 Test Results

  • 111318 tests passed
  • 4420 tests skipped

@s-barannikov
Copy link
Contributor

Tagging as WIP for now since I'm not really sure where to put the tests for this.

Most targets keep clang tests under clang/test/CodeGen/<Target>

@koachan
Copy link
Contributor Author

koachan commented Nov 18, 2025

Tagging as WIP for now since I'm not really sure where to put the tests for this.

Most targets keep clang tests under clang/test/CodeGen/<Target>

Seems like SPARC tests are still not grouped yet. I'll make it here and do a follow-up patch to move the other tests to its own directory.

@koachan koachan changed the title [WIP][SPARC][clang] Add condition code register names for inline asm [SPARC][clang] Add condition code register names for inline asm Nov 18, 2025
Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@koachan koachan merged commit 52ed0f2 into llvm:main Nov 19, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:Sparc clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants